

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="save_undo" />
        <title>${Inter.printOut('Edit Employee',session.language)}</title>
    </head>
    <body>
        <div class="undernav">
            <span class="menuButton"><g:link class="createEmployee" action="create">${Inter.printOut('New Employee',session.language)}</g:link></span>
            <!-- This is the help button. -->
            <%  def help = Help.findByNameAndLanguage("employee_edit", session.language)
            def helplink = createLink(action:'show', controller:'help', id: help.id )%>
            <a href="#" onClick="MyWindow=window.open('${helplink}','Help','width=350,height=450'); return false;">${Inter.printOut('Help',session.language)}</a>
            <!-- This is the end of the help button. -->
        </div>
        <div class="body">
    <!-- <div class="mode">
              <span style="font-weight:bold; padding-right:10px">
              <g:if test="${session.mode == null || session.mode.equalsIgnoreCase('sandbox')}">
                ${Inter.printOut('Sandbox mode',session.language)}
                <g:btnSaveUndo currentView="edit" currentController="employee" idProject="${employeeInstance?.id}" />
              </g:if>
              <g:else>
                ${Inter.printOut('Budget mode',session.language)}
              </g:else>
                </span>
            </div> -->
            <h1>${Inter.printOut('Edit Employee',session.language)}</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${employeeInstance}">
            <div class="errors">
                <g:renderErrors bean="${employeeInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${employeeInstance?.id}" />
                <input type="hidden" name="version" value="${employeeInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                          <!-- Has no validation, can crash the site if wrong value is inserted
                             <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="employeeId">${Inter.printOut('Employee Id:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'employeeId','errors')}">
                                    <input readonly type="text" id="employeeId" name="employeeId" value="${fieldValue(bean:employeeInstance,field:'employeeId')}" />
                                </td>
                            </tr>
                          -->
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="firstName">${Inter.printOut('First Name:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'firstName','errors')}">
                                  <input type="text" id="firstName" name="firstName" value="${fieldValue(bean:employeeInstance,field:'firstName')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastName">${Inter.printOut('Last Name:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'lastName','errors')}">
                                    <input type="text" id="lastName" name="lastName" value="${fieldValue(bean:employeeInstance,field:'lastName')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="street">${Inter.printOut('Street:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'street','errors')}">
                                    <input type="text" id="street" name="street" value="${fieldValue(bean:employeeInstance,field:'street')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="city">${Inter.printOut('City:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'city','errors')}">
                                    <input type="text" id="city" name="city" value="${fieldValue(bean:employeeInstance,field:'city')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="zipCode">${Inter.printOut('Zip Code:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'zipCode','errors')}">
                                    <input type="text" id="zipCode" name="zipCode" value="${employeeInstance.zipCode}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dob">${Inter.printOut('Dob:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'dob','errors')}">
                                    <g:datePicker name="dob" value="${employeeInstance?.dob}" precision="day" ></g:datePicker>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="email">${Inter.printOut('Email:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'email','errors')}">
                                    <input type="text" id="email" name="email" value="${fieldValue(bean:employeeInstance,field:'email')}"/>
                                </td>
                            </tr>

                           <!--Deleted the codes for username for employee-->
                            <!--Deleted the password as well-->
                            <!--Verify passwrord too-->
                            <!-- no verifyig password-->
                  

                             <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="phoneNumber">${Inter.printOut('Phone number:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'phoneNumber','errors')}">
                                   <input type="text" id="phoneNumber" name="phoneNumber" value="${fieldValue(bean:employeeInstance,field:'phoneNumber')}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title">${Inter.printOut('Title:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'title','errors')}">
                                    <input  type="text" id="title" name="title" value="${fieldValue(bean:employeeInstance,field:'title')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="salary">${Inter.printOut('Salary:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'salary','errors')}">
                                    <input  type="text" id="salary" name="salary" value="${fieldValue(bean:employeeInstance,field:'salary')}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="percentageWork">${Inter.printOut('Percentage Work:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'percentageWork','errors')}">
                                    <input type="text" id="percentageWork" name="percentageWork" value="${fieldValue(bean:employeeInstance,field:'percentageWork')}%" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="hiredBy">${Inter.printOut('Hired By:',session.language)}</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'hiredBy','errors')}">
                                    <g:select optionKey="id" from="${session.access.getList('area')}" name="hiredBy.id" value="${employeeInstance?.hiredBy?.id}" noSelection="['null':'']"></g:select>
                                </td>
                            </tr> 

                           
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="${Inter.printOut('Update',session.language)}" action="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('${Inter.printOut('Sure',session.language)}');" value="${Inter.printOut('Delete',session.language)}" action="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>